from moviepy.editor import VideoFileClip

video_path = "/home/chf/python_obj/KBD/static/test_video-1.avi"
# 输入视频文件名
# video_path = "input_video.avi"

# 指定时间范围（单位为秒）
start_time = 8 * 60 + 30
end_time = 9 * 60

# 读取视频文件
video = VideoFileClip(video_path)

# 截取指定时间范围的视频内容
subclip = video.subclip(start_time, end_time)

# 保存截取后的视频内容
output_path = "output_video.avi"
subclip.write_videofile(output_path, codec="mpeg4", fps=60, bitrate="13499k")  # 选择合适的编解码器

# 关闭视频文件
video.close()
